package siyuan.run.logger.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import siyuan.run.logger.feignclient.MyFeignClient;
import siyuan.run.logger.model.User;

import java.util.HashMap;
import java.util.Map;

/**
 * @program: sy
 * @description:
 * @author: Jacob
 * @create: 2020-11-24 20:06
 **/
@RestController
public class FeignController {

    @Autowired
    private MyFeignClient myFeignClient;

    @GetMapping("hello")
    public String hello(){
        String result = myFeignClient.hello();
        System.out.println("远程服务调用:"+result);
        return result;
    }

    @GetMapping("get1")
    public String get1(){
        return myFeignClient.get1(1,"siyuan");
    }

    @GetMapping("get2")
    public Map<String, Object> get2(){
        Map<String,Object> map = new HashMap<>();
        map.put("get2","get2");
        return myFeignClient.get2(map);
    }

    @PostMapping("post1")
    public User post1(){
        return myFeignClient.post1(new User(2,2));
    }

}
